; find the sum of the squares of two floating point numbers
; Author:  R. Detmer
; Date:    4/98

.386
.MODEL FLAT

.STACK  4096             ; reserve 4096-byte stack

.DATA                    ; reserve storage for data
value1  REAL4   0.5
value2  REAL4   1.2
sqrt    REAL4   ?


.CODE
_start:
        fld    value1   ; value1 in ST
        fld    st       ; value1 in ST and ST(1)
        fmul            ; value1*value1 in ST
        fld    value2   ; value2 in ST (value1*value1 in ST(1)
        fld    st       ; value2 in ST and ST(1)
        fmul            ; value2*value2 in ST
        fadd            ; sum of squares in ST
        fsqrt           ; square root of sum of squares in ST
        fstp   sqrt     ; store result

PUBLIC _start
END

